package com.elastic.chain;

import com.elastic.ESMajorManage;
import org.elasticsearch.index.query.BoolQueryBuilder;

/**
 * @ClassName QueryAdapter
 * @Author xiezhuocai
 * @Description TODO
 * @Date 2021/12/28 17:57
 */
public class QueryAdapter extends MustAdaptee implements ChooseQuery {
    @Override
    public Leader mustWildcardQuery(final String field) {
        Leader leader = new Leader() {
            @Override
            public boolean handleRequest(BoolQueryBuilder boolQuery, String key, Object value) {
                if (field.equals(key)) {
                    wildcardQuery(boolQuery,key,value);
                    return true;
                }
                return false;
            }
        };
        return leader;
    }
}
